using Microsoft.SPOT.Hardware;

namespace CSharpDuino
{
    using SecretLabs.NETMF.Hardware;
    using SecretLabs.NETMF.Hardware.NetduinoPlus;

    public class Buzz
    {
        private readonly PWM beeper;

        public Buzz(Cpu.Pin pin)
        {
            this.beeper = new PWM(pin);
        }

        public void Beep()
        {
            beeper.SetPulse(1000, 100);
            for (int n = 0; n < 1000; n++)
            {
            }
            beeper.SetPulse(0, 0);
        }

        public void Play(uint f)
        {
            beeper.SetPulse(f, 100);
            for (int n = 0; n < 1000; n++)
            {
            }
            beeper.SetPulse(0, 0);
        }
    }
}
